<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	request.setCharacterEncoding("UTF-8");
	response.setContentType("text/html;charset=UTF-8");
%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	String path = request.getContextPath();
%>
<html lang="zh-cn">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="format-detection" content="telephone=no, email=no" />
<title>登录</title>
<link rel="stylesheet" href="<%=path %>/admin/css/pintuer.css">
<link rel="stylesheet" href="<%=path %>/admin/css/admin.css">
<script type="text/javascript"> var paths = '<%=path%>'; </script>
<script src="<%=path %>/admin/js/jquery.js"></script>
<script src="<%=path %>/admin/js/pintuer.js"></script>
<script src="<%=path %>/admin/js/pic.js"></script>
<script type="text/javascript" src="<%=path%>/admin/js/lrz.bundle.js"></script>
<script type="text/javascript" src="<%=path%>/admin/js/lrz.all.bundle.js"></script>
<script type="text/javascript" src="<%=path%>/admin/js/1.chunk.js"></script>
<script type="text/javascript" src="<%=path%>/admin/js/2.chunk.js"></script>
<script type="text/javascript" src="<%=path %>/admin/js/admin.js"></script>
<link href="<%=path%>/static/js/fileUpload/iconfont.css" rel="stylesheet" type="text/css"/>
 <link href="<%=path%>/static/js/fileUpload/fileUpload.css" rel="stylesheet" type="text/css">
 <script type="text/javascript" src="<%=path%>/static/js/fileUpload/fileUpload.js"></script>

</head>
<body>
	<div class="panel admin-panel">
		<div class="panel-head" id="add">
			<strong><span class="icon-pencil-square-o"></span>贷款公司</strong>
		</div>
		<div class="body-content">
			<form id="planForm" method="post" class="form-x" action="<%=path %>/platfrom/save">
			<input type="hidden" value="${entity.id}" name="id" id="id"/>
				<div class="form-group">
					<div class="label">
						<label>贷款公司：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50 clear" value="${entity.name}" name="name" id="name" data-validate="required:请输入贷款公司" />
						<div class="tips"></div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>URL：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50 clear" value="${entity.url}" name="url" id="url" data-validate="required:请输入贷款公司url"/>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>描述：</label>
					</div>
					<div class="field">
						<textarea class="input w50 clear" style="height: 130px; overflow-y: scroll;"
							onKeyDown="LimitTextArea(this)" onKeyUp="LimitTextArea(this)"
							onkeypress="LimitTextArea(this)" title="您的最大输入长度为100字"
							name="description" id="description" data-validate="required:请输入贷款公司描述">${entity.description}</textarea>
						<div class="tips"></div>
					</div>
				</div>
				<div class="form-group">
				     <div class="label">
                        <label>额度：</label>
                    </div>
                    <div class="field">
                        <input type="text" class="input w50 clear" name="summary" id="summary" value="${entity.summary}" data-validate="required:请输入贷款公司额度">
                    </div>
				</div>
               <div class="form-group">
                     <div class="label">
                        <label>排序：</label>
                    </div>
                    <div class="field">
                        <input placeholder="范围 0~99,数值越大排序越靠后" 
                         onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="2"
                          type="text" class="input w50 clear" name="sort" id="sort" value="${entity.sort}" data-validate="required:请输入序号">
                    </div>
                </div>
                <div class="form-group">
                    <div class="label">
			          <label>产品类型：</label>
			        </div>
			        <div class="field">
			            <select class="input w50" id="type" name="type" data-validate="required:请选择类型">
			                <option value="1" ${entity.type eq "1" ? 'selected':""}>现金贷</option>
			                <option value="2" ${entity.type eq "2" ? 'selected':""}>信用卡代还</option>
			            </select>
			          <!-- <input type="text" class="input w50 clear" value="" name="adPassword" id="adPassword" data-validate="required:请输入密码" /> -->
			          <div class="tips"></div>
                </div>
				<div class="form-group">
					<div style="width: 100%; float: left">
						<div class="label">
							<label>状态：</label>
						</div>
						<div class="field" style="width: 80%">
							<div class="dx">
								<label><input type="radio" value="1"name="state" <c:choose><c:when test="${entity.state==1}">checked="checked"</c:when><c:otherwise>checked="checked"</c:otherwise></c:choose>/>启用</label> 
								<label><input type="radio" value="0" name="state" <c:if test="${entity.state==0}">checked="checked"</c:if>/>禁用</label>
							</div>
						</div>
					</div>
				</div>
		
				<div class="form-group">
					<div class="label">
						<label>图标：</label>
					</div>
					<input type="hidden" value="${entity.icon}" name="icon" id="icon"/>
					<div class="field">
						<div id="fileUploadContent" class="fileUploadContent"></div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label></label>
					</div>
					<div class="field">
						<button class="button bg-main icon-check-square-o" type="button"
							onclick="javascript:sub();">提交</button>
						<input type="hidden" name="subTag" id="subTag" />
					</div>
				</div>
			</form>
		</div>
	</div>
</body>

<script type="text/javascript">
	$("#fileUploadContent").initUpload({
	    "uploadUrl":paths+"/platfrom/upload",//上传文件信息地址
	    //"size":350,//文件大小限制，单位kb,默认不限制
	    //"maxFileNumber":1,//文件个数限制，为整数
	    //"filelSavePath":"",//文件上传地址，后台设置的根目录
	    "beforeUpload":beforeUploadFun,//在上传前执行的函数
	    "onUpload":onUploadFun,//在上传后执行的函数
	    autoCommit:true,//文件是否自动上传
	    //"fileType":['png','jpg',],//文件类型限制，默认不限制，注意写的是文件后缀
	});
	function beforeUploadFun(opt){
		
	    opt.otherData =[{"name":"name","value":"zxm"}];
	    //uploadTools.initWithCleanFile(opt);
	}
	function onUploadFun(opt,data){
		$("#icon").val(data);
	    uploadTools.uploadError(opt);//显示上传错误
	}
	var icon = $("#icon").val();
	
	if(icon!=""){
		
    $(".box").html(uploadTools.getShowFileType(true,"","22",paths+"/file/getImg.html?saveAddress="+icon,"1ll"));
	}
    
    
    
	$(function(){
		var subTag = '${param.subTag}';
		if(subTag==1){
			layer.msg('操作成功！');
		}else if(subTag== 2){
			layer.msg('系统忙！');
		}
	});
	function LimitTextArea(field){ 
	    maxlimit=100; 
	    if (field.value.length > maxlimit) 
	     field.value = field.value.substring(0, maxlimit);
	  }
	function sub(){

		$("#planForm").submit();
		
	};
	

	$(".plantags").change(function(){
		var roleitem = "";
		$("input[name='checkTag']").each(function(){
			if($(this).prop("checked")){
				if(roleitem == ""){
				roleitem += $(this).val();
				}
				else{
				roleitem += ","+$(this).val();
				}
			}
		});
		$("#planTag").val(roleitem);
		
	});
	
</script>
</html>